Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPDEV-100486] Support kernel parameters/modules per group/node #639

Merged
merged 10 commits into from
Apr 26, 2024

Conversation

ilia1243
Copy link
Contributor

@ilia1243 ilia1243 commented Apr 12, 2024

Description

  • Support kernel modules per group/node.
  • Support kernel parameters per group/node.

Solution

  • Format of services.modprobe is extended to support dictionary with properties modulename, nodes, groups, install.
  • Format of services.sysctl is extended to support dictionary with properties value, nodes, groups, install.
  • Existing defaults are moved to the new format, and distributed among roles.
  • Added patch that sets previous default kernel parameters and modules in the user inventory,
    to keep them on all nodes, and preserve potential references to them in jinja templates.
  • Implemented new patches section of the inventory that allows to specify different values of kernel parameters for different nodes.
  • Other fixes and improvements:
    • All sysctl.d configs are now reloaded through sysctl --system.
      This allows to perform early validation of parameters.
    • More robust check modprobe.is_modprobe_valid() that the required modules are present.

How to apply

Run kubemarine migrate_kubemarine --force-apply preserve_compatibility_kernel

Test Cases

TestCase 1

Installation with default kernel parameters/modules per group/node.

Steps:

  1. Install cluster with default parameters/modules.

ER: The parameters / modules are installed only on necessary nodes/groups.

TestCase 2

Migrate inventory.

Steps:

  1. Install cluster using old Kubemarine version.
  2. Run kubemarine migrate_kubemarine --force-apply preserve_compatibility_kernel using new Kubemarine version.

ER: previous default kernel parameters/modules are set in the inventory.

  1. Add some new parameter in services.sysctl.
  2. Run install --tasks prepare.system.sysctl using new Kubemarine version.

ER: The parameters / modules are installed on all nodes.

TestCase 3

Installation with kernel parameters/modules per group/node.

Steps:

  1. Configure inventory with extended format of services.sysctl / services.modprobe and specify subset of nodes/groups to install the parameters/modules on.
  2. Install the cluster.

ER: The parameters / modules are installed only on specified nodes/groups.

  1. Run check_paas --tasks services.system.modprobe,services.system.sysctl

ER: Check is successful.

TestCase 4

Install kernel parameters with different values per group/node using patches.

Steps:

  1. Configure inventory with patches and specify different kernel parameter values to install on different nodes/groups.
  2. Install the cluster.

ER: Different parameters values are installed as per the configuration.

  1. Run check_paas --tasks services.system.sysctl

ER: Check is successful.

TestCase 5

PaaS check with changed parameters/modules per group/node.

Steps:

  1. Configure inventory with extended format of services.sysctl / services.modprobe and specify subset of nodes/groups to install the parameters/modules on.
  2. Install the cluster.
  3. Add group/node to one of existing parameter/module in the inventory.
  4. Run check_paas --tasks services.system.modprobe,services.system.sysctl

ER: The checks fail with some nodes having not installed parameters/modules.

TestCase 6

PaaS check with changed kernel parameter values.

  1. Install the cluster.
  2. Add patches with different kernel parameters values.
  3. Run check_paas --tasks services.system.sysctl

ER: The checks fail with some nodes not having the expected parameter values.

TestCase 7

Early sysctl validation without reboot.

  1. Configure kernel parameter with the higher priority, for example in /etc/sysctl.d/99-*.conf.
  2. Configure different value for the parameter in the inventory.
  3. Run install --exclude-cumulative-points-methods kubemarine.system.reboot_nodes

Results:

Before After
Installation is successful Installation fails because the parameter value is not expected
  1. Reboot the cluster
  2. Run check_paas --tasks services.system.sysctl

AR=ER: the check fails.

TestCase 8

Robust PaaS check that kernel modules are valid.

Steps:

  1. Configure inventory
services:
  modprobe:
    <OS family>:
      - '0'
  1. Run check_paas --tasks services.system.modprobe

Results:

Before After
Check is successful Check fails with "Kernel module 0 is not found"

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Integration CI passed
  • Unit tests. If Yes list of new/changed tests with brief description
  • There is no merge conflicts

Unit tests

test_defaults.py - cover new cases with enrichment of integer/boolean values.
test_sysctl.py, test_modprobe.py - new tests to cover enrichment of sysctl and modprobe.

@ilia1243 ilia1243 marked this pull request as draft April 12, 2024 09:06
@ilia1243 ilia1243 force-pushed the feature/sysctl_per_node branch 13 times, most recently from dadf6c3 to 6cece6b Compare April 19, 2024 09:56
@ilia1243 ilia1243 force-pushed the feature/sysctl_per_node branch 2 times, most recently from c819bdc to cfeb70c Compare April 19, 2024 16:03
@ilia1243 ilia1243 marked this pull request as ready for review April 19, 2024 16:04
@ilia1243 ilia1243 changed the title [CPDEV-100486] Support kernel parameters per group/node [CPDEV-100486] Support kernel parameters/modules per group/node Apr 19, 2024
@ilia1243 ilia1243 added the bug Something isn't working label Apr 19, 2024
@ilia1243
Copy link
Contributor Author

@shmo1218 please review JSON schemas in kubemarine/resources/schemas modified in this PR apart from usual docs.

@koryaga koryaga merged commit ec62a75 into main Apr 26, 2024
43 checks passed
@koryaga koryaga deleted the feature/sysctl_per_node branch April 26, 2024 09:37
@ilia1243 ilia1243 mentioned this pull request May 8, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants